package com.chixing.day10_hashcode_exception;

import java.util.Objects;

public class Student {
    private int stuId;
    private String stuName;
    private String stuMajor;
    private long stuTelno;

    public Student(){}
    public int getStuId() {
        return stuId;
    }

    public void setStuId(int stuId) {
        this.stuId = stuId;
    }

    public String getStuName() {
        return stuName;
    }

    public void setStuName(String stuName) {
        this.stuName = stuName;
    }

    public String getStuMajor() {
        return stuMajor;
    }

    public void setStuMajor(String stuMajor) {
        this.stuMajor = stuMajor;
    }

    public long getStuTelno() {
        return stuTelno;
    }

    public void setStuTelno(long stuTelno) {
        this.stuTelno = stuTelno;
    }




    @Override
    public String toString() {
        return "Student{" +
                "stuId=" + stuId +
                ", stuName='" + stuName + '\'' +
                ", stuMajor='" + stuMajor + '\'' +
                ", stuTelno=" + stuTelno +
                '}';
    }
    //重写equals 方法，比较所有属性
    @Override
    public boolean equals(Object obj) {
        if (obj instanceof Student){
          Student student =(Student) obj;
          return stuName.equalsIgnoreCase(student.getStuName());
        }

        return false;
    }


}
